unit Alta_Costos;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DB, Mask, DBCtrls;

type
  TF_AltaCostos = class(TForm)
    Label1: TLabel;
    DBEdit1: TDBEdit;
    DataSource1: TDataSource;
    Label2: TLabel;
    DBEdit2: TDBEdit;
    GroupBox1: TGroupBox;
    B_Cancel: TButton;
    B_Accept: TButton;
    procedure B_AcceptClick(Sender: TObject);
    procedure B_CancelClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  F_AltaCostos: TF_AltaCostos;

implementation

{$R *.dfm}

procedure TF_AltaCostos.B_AcceptClick(Sender: TObject);
begin
  if ((TRIM(DBEdit1.Text) = '') OR (TRIM(DBEdit2.Text) = '')) THEN
    ShowMessage('Debe completar todos los datos requeridos.')
  ELSE
  BEGIN
    DataSource1.DataSet.Append;
    DataSource1.DataSet.Refresh;
    SELF.Close;
  END;
end;

procedure TF_AltaCostos.B_CancelClick(Sender: TObject);
begin
   DataSource1.DataSet.Cancel;
   SELF.Close;
   DataSource1.DataSet.First;
end;

procedure TF_AltaCostos.FormClose(Sender: TObject; var Action: TCloseAction);
begin
   DataSource1.DataSet.Cancel;
end;

end.
